package top.wangxiaomei.ai.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import top.wangxiaomei.ai.domain.Words;
import top.wangxiaomei.ai.other.Abs;
import top.wangxiaomei.ai.service.WordsService;
import top.wangxiaomei.ai.mapper.WordsMapper;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
* @author Work
* &#064;description  针对表【words】的数据库操作Service实现
* &#064;createDate  2024-07-04 10:00:11
 */
@Service
public class WordsServiceImpl extends ServiceImpl<WordsMapper, Words>
    implements WordsService{


    public String defWord(String word) {
        String result = "未知错误";
        word = word.trim();
        String[] w = word.split(" ");

        if (w.length == 1) {
            result = "请输入正确的单词或句子";
        }
        if (w.length == 2) {
            Words words = new Words(w[0], w[1]);
            result = this.baseMapper.insert(words) > 0 ? "录入成功" : "录入失败";
        }
        return result;
    }
    public List<Abs> getEx(String word){
        return this.baseMapper.getEx(word);
    }


}




